package com.escool.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.escool.dto.EstudianteDetalleDTO;
import com.escool.model.SgUsuarios;
import com.escool.model.TbGrado;
import com.escool.model.TbNivel;

import com.escool.model.TbActividad;


import com.escool.service.CatEventoService;
import com.escool.service.FindService;
import com.escool.service.GradosService;
import com.escool.service.NivelesService;
import com.escool.service.RolService;

@Controller
public class AlumnoMateriasController {
	
	@Autowired
	FindService findService;

	
	@RequestMapping("showAlumnoMaterias")
	public String showCatActividad(Map<String, Object> map) {
		try{
		User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		map.put("estudianteDetalleDTO", new EstudianteDetalleDTO());
		map.put("vwAlumnoNotasList",
				findService.listVwAlumnoNotas(user.getUsername()));

		System.out.println("nombre logado" + user.getUsername());
		return "/alumnoMaterias";
		}catch(Exception e){
			return "redirect:/login";
		}
	}
}
